fix(revm): 2d nonce gas schedule#1442
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
| // New key - progressive cost based on number of active keys | ||
| let active_count = nonce_manager | ||
| .get_active_nonce_key_count(getActiveNonceKeyCountCall { account: caller })?; | ||
| Ok((active_count.saturating_to::<u64>() + 1) * NEW_NONCE_KEY_MULTIPLIER) | ||
| } |
There was a problem hiding this comment.
hmm that seems super expensive and kinda breaks the usecase of using random nonce keys to not care about your nonces
after all it's just a cold sstore to non-existent slot which costs 22100 usually, why does it have to scale with number of active keys?
There was a problem hiding this comment.
Initially when we designed this dan and georgios were concerned about state bloat. We were discussing adding garbage collection and state rent, but unlike other state 2d nonces can never be garbage collected because it would lead to tx replay attacks.
So we wanted to limit the number of nonce keys a user could create.
There was a problem hiding this comment.
I still think some of those concerns exist. But since we are relaxing our requirements for state bloat solutions, we can probably also relax them for 2d nonces.
This comes with the added benefit that we don't have to keep an active nonce key count.
There was a problem hiding this comment.
I have updated this to remove this linear gas cost for now, as I think the perf benefits of not having to keep track of the active nonce key count, alone makes it worth it.
When we update the new state creation gas costs, we can update this accordingly
| // Add 2D nonce gas to the initial gas | ||
| let adjusted_gas = InitialAndFloorGas::new( | ||
| init_and_floor_gas.initial_gas + evm.nonce_2d_gas, | ||
| init_and_floor_gas.floor_gas, | ||
| ); |
There was a problem hiding this comment.
cc @rakita validate_initial_tx_gas should take &mut Evm so that we don't have to do this hack
3a8653a
into
tanishk/access-key-gas-schedule
Adds a gas schedule for 2d nonces as written in the spec.
Without this the node can be susceptible to storage DOS vectors.
We also do a minor update in the gas schedule mentioned in the specs, to start the incrementing nonce costs from
20,000instead of0